<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>发布者选项</title>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/bootcdn/BootCDN/ajax/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/hplus/css/style.min.css"/>
<link rel="stylesheet" type="text/css" href="<%=path%>/hplus/css/font-awesome.min93e3.css"/>
<link rel="stylesheet" type="text/css" href="<%=path%>/hplus/css/plugins/iCheck/custom.css"/>
</head>
<body>
<div class="container-fluid">
	<form class="form-horizontal">
		<div class="form-group">
		    <label class="col-sm-2 control-label">关键词设置</label>
		    <div class="col-sm-5">
		        <input id="keyword" type="text" class="form-control">
		    </div>
		    <div class="col-sm-2 control-label">
				<p class="text-left">必填，建议5个词以内</p>
		    </div>
		</div>
		<div class="form-group">
	        <label class="col-sm-2 control-label">是否为认证用户</label>
	        <div class="col-sm-2" style="padding: 0;width: 80px;">
	        	<div class="radio i-checks"><label><input type="radio" value="" name="hasv" checked="checked">不限</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="1" name="hasv">是</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="0" name="hasv">否</label></div>
	       	</div>
	    </div>
	    <!-- 
	    <div class="form-group">
	        <label class="col-sm-2 control-label">用户性别</label>
	        <div class="col-sm-2" style="padding: 0;width: 80px;">
	        	<div class="radio i-checks"><label><input type="radio" value="option1" name="b" checked="checked">不限</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="option1" name="b">是</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="option1" name="b">否</label></div>
	       	</div>
	    </div>
	     -->
	    <div class="form-group">
	        <label class="col-sm-2 control-label">用户省份</label>
	        <div class="col-sm-2">
	        	<select class="form-control" name="province" id="province" onchange="func_getCity(this.value)">
					<option value="">请选择</option>
	             </select>
	        </div>
	        <div class="col-sm-2">
	        	<select class="form-control" name="city" id="city">
					<option value="">请选择</option>
	            </select>
	        </div>
	    </div>
	    <div class="form-group">
	        <label class="col-sm-2 control-label">是否原创</label>
	        <div class="col-sm-2" style="padding: 0;width: 80px;">
	        	<div class="radio i-checks"><label><input type="radio" value="" name="hasori" checked="checked">不限</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="1" name="hasori">是</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="0" name="hasori">否</label></div>
	       	</div>
	    </div>
	    <div class="form-group">
	        <label class="col-sm-2 control-label">是否包含转发</label>
	        <div class="col-sm-2" style="padding: 0;width: 80px;">
	        	<div class="radio i-checks"><label><input type="radio" value="" name="hasret" checked="checked">不限</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="1" name="hasret">是</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="0" name="hasret">否</label></div>
	       	</div>
	    </div>
	    <div class="form-group">
	        <label class="col-sm-2 control-label">是否为纯文本</label>
	        <div class="col-sm-2" style="padding: 0;width: 80px;">
	        	<div class="radio i-checks"><label><input type="radio" value="" name="hastext" checked="checked">不限</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="1" name="hastext">是</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="0" name="hastext">否</label></div>
	       	</div>
	    </div>
	    <div class="form-group">
	        <label class="col-sm-2 control-label">是否包含图片</label>
	        <div class="col-sm-2" style="padding: 0;width: 80px;">
	        	<div class="radio i-checks"><label><input type="radio" value="" name="haspic" checked="checked">不限</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="1" name="haspic">是</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="0" name="haspic">否</label></div>
	       	</div>
	    </div>
	    <div class="form-group">
	        <label class="col-sm-2 control-label">是否包含视频</label>
	        <div class="col-sm-2" style="padding: 0;width: 80px;">
	        	<div class="radio i-checks"><label><input type="radio" value="" name="hasvideo" checked="checked">不限</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="1" name="hasvideo">是</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="0" name="hasvideo">否</label></div>
	       	</div>
	    </div>
	    <div class="form-group">
	        <label class="col-sm-2 control-label">是否包含音乐</label>
	        <div class="col-sm-2" style="padding: 0;width: 80px;">
	        	<div class="radio i-checks"><label><input type="radio" value="" name="hasmusic" checked="checked">不限</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="1" name="hasmusic">是</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="0" name="hasmusic">否</label></div>
	       	</div>
	    </div>
	    <div class="form-group">
	        <label class="col-sm-2 control-label">是否包含链接</label>
	        <div class="col-sm-2" style="padding: 0;width: 80px;">
	        	<div class="radio i-checks"><label><input type="radio" value="" name="haslink" checked="checked">不限</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="1" name="haslink">是</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="0" name="haslink">否</label></div>
	       	</div>
	    </div>
	    <div class="form-group">
	        <label class="col-sm-2 control-label">是否包含@</label>
	        <div class="col-sm-2" style="padding: 0;width: 80px;">
	        	<div class="radio i-checks"><label><input type="radio" value="" name="hasat" checked="checked">不限</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="1" name="hasat">是</label></div>
	        </div>
	        <div class="col-sm-1" style="padding: 0;">
	        	<div class="radio i-checks"><label><input type="radio" value="0" name="hasat">否</label></div>
	       	</div>
	    </div>
	    <div class="form-group">
            <div class="col-sm-offset-2 col-sm-1">
                <button onclick="parent.optionDialog.remove()" class="btn btn-sm btn-white" type="button" style="border-color: #18a689;">上一步</button>
            </div>
            <div class="col-sm-offset-2 col-sm-1">
                <button onclick="parent.saveDialog()" class="btn btn-sm btn-primary" type="button">保存</button>
            </div>
        </div>
	</form>
</div>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/bootcdn/BootCDN/ajax/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<%=path%>/hplus/js/plugins/iCheck/icheck.min.js"></script>
<script type="text/javascript">
var path = "<%=path%>";
$(function(){
	$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",});
	$("#highCondition").click(function(){
		if($(this).text() == "更多高级条件设置"){
			$(this).text("收起高级条件设置");
			$(".highCondition").show();
		}else{
			$(this).text("更多高级条件设置");
			$(".highCondition").hide();
		}
	});
	
	func_getProvince();
	
	init();
});

/**
 * 获取省份
 */
function func_getProvince(){
	$.post(path+"/scan/findPeople/getAddress",{parent_code:'001'},function(data){
		var province = data;
		$.each(province,function(i,a){
			$("#province").append('<option value="'+a.code+'">'+a.name+'</option>');
		});
		if(parent.rule != null){
			$("#province>option[value='"+parent.rule.province+"']").attr("selected",true);
			func_getCity(parent.rule.province);
		}
	},"json");
}

function func_getCity(code){
	$("#city").html('<option value="">请选择</option>');
	$.post(path+"/scan/findPeople/getAddress",{parent_code:code},function(data){
		var city = data;
		$.each(city,function(i,a){
			$("#city").append('<option value="'+a.code+'">'+a.name+'</option>');
		});
		if(parent.rule != null){
			$("#city>option[value='"+parent.rule.city+"']").attr("selected",true);
		}
	},"json");
}

function init(){
	func_backShow();
}

//回显
function func_backShow(){
	if(parent.rule != null){
		var keyword = "";
		$.each(parent.rule.keyword.split("~"),function(i,d){
			keyword += ","+d;
		});
		if(keyword != ""){
			keyword = keyword.substr(1);
		}
		$("#keyword").val(keyword);
		if(parent.rule.hasv){
			$(":radio[name='hasv'][value='"+parent.rule.hasv+"']").iCheck('check');
		}
		if(parent.rule.hasori){
			$(":radio[name='hasori'][value='"+parent.rule.hasori+"']").iCheck('check');
		}
		if(parent.rule.hasret){
			$(":radio[name='hasret'][value='"+parent.rule.hasret+"']").iCheck('check');
		}
		if(parent.rule.hastext){
			$(":radio[name='hastext'][value='"+parent.rule.hastext+"']").iCheck('check');
		}
		if(parent.rule.haspic){
			$(":radio[name='haspic'][value='"+parent.rule.haspic+"']").iCheck('check');
		}
		if(parent.rule.hasvideo){
			$(":radio[name='hasvideo'][value='"+parent.rule.hasvideo+"']").iCheck('check');
		}
		if(parent.rule.hasmusic){
			$(":radio[name='hasmusic'][value='"+parent.rule.hasmusic+"']").iCheck('check');
		}
		if(parent.rule.haslink){
			$(":radio[name='haslink'][value='"+parent.rule.haslink+"']").iCheck('check');
		}
		if(parent.rule.hasat){
			$(":radio[name='hasat'][value='"+parent.rule.hasat+"']").iCheck('check');
		}
	}
}
</script>
</html>